package com.itWaiLong.Controller.admin;

import com.itWaiLong.Dao.User;
import com.itWaiLong.Result.Result;
import com.itWaiLong.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/selectUser")
public class SelectController {

    @Autowired
    private UserService userService;

    /**
     * 查找用户
     * @return
     */
    @GetMapping("/selectUserById")
    public Result SelectUserById(){
        User user = userService.selectUserById();
        return Result.success(user);
    }

    /**
     * 管理员查找所有用户信息
     * @return
     */
    @GetMapping("/selectAllUser")
    public Result<List<User>> SelectAllUser(){
        List<User> users = userService.selectAllUser();
        return Result.success(users);
    }
}
